package org.hmh.util;

import org.hmh.leetcode.dataStruct.TreeNode;

import java.util.LinkedList;
import java.util.Queue;

/**
 * Created this one by HMH on 2018/1/19.
 */
public class TreeUtil {

    public static void print(TreeNode treeNode) {
        Queue<TreeNode> base = new LinkedList<>();
        base.add(treeNode);
        while(base.size()>0){
            TreeNode root = base.poll();
            System.out.println(root.val);
            if (root.left != null) {
                base.add(root.left);
            }
            if (root.right != null) {
                base.add(root.right);
            }
        }
    }
}
